#pragma  once
#include "stdafx.h"

using namespace std;

class Units : public QObject
{
	Q_OBJECT

public:
	Units(){init_list();};
	~Units(){};
	const void init_list();
	QStringList getUnitList(const QString &_unit);
	QStringList getUnitListForParameter(const QString &_name);
	QStringList getParameterList();
	double getCoeff(const QString &_init);
	QString getShortName(const QString &_name);
	QStringList getCalcParameters();
private:
	vector<vector<QString>> unitMatrix;
	vector<vector<double>> coeffMatrix;
	hash_map<string, int> matching;
	hash_map<string, QString> shortName;
	QStringList calcParameters;
private slots:
	
signals:
		
};

extern hash_map<string, int> defaultUnits;
inline QString getDefaultUnitText(const QString &_parameter) {	Units *unitlist = new Units(); return unitlist->getUnitListForParameter(_parameter)[defaultUnits[_parameter.toStdString()]]; };
inline int getDefaultUnitIndex(const QString &_parameter) { return defaultUnits[_parameter.toStdString()]; };